package com.example.fizzbuzz.stage2;

public class FizzBuzz {
    private final static String FIZZ = "FIZZ";
    private final static String BUZZ = "BUZZ";
    private final static String FIZZBUZZ = "FIZZBUZZ";

    public String currentWord(int currentNum) {

        if (isFizzBuzz(currentNum)) {
            return FIZZBUZZ;
        }
        if (isFizz(currentNum)) {
            return FIZZ;
        }
        if (isBuzz(currentNum)) {
            return BUZZ;
        }
        return getNumString(currentNum);
    }

    /**
     * int 转string
     * @param input
     * @return
     */
    private String getNumString(int input){
        return String.valueOf(input);
    }

    private boolean isFizz(int input){
        return isNumFizz(input)||isStringFizz(getNumString(input));
    }
    private boolean isNumFizz(int input){
        return input%3==0;
    }
    private boolean isStringFizz(String input){
        return input.contains("3");
    }



    private boolean isBuzz(int input){
        return isNumBuzz(input)||isStringBuzz(getNumString(input));
    }
    private boolean isNumBuzz(int input){
        return input%5==0;
    }
    private boolean isStringBuzz(String input){
        return input.contains("5");
    }



    private boolean isFizzBuzz(int input){
        return isFizz(input)&&isBuzz(input);
    }


}
